﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Ad_ThamSoUC.ascx.cs" Inherits="GUI.Admin.uc.Ad_ThamSoUC" %>
<%@ Register Assembly="EO.Web" Namespace="EO.Web" TagPrefix="eo" %>
<%@ Register Assembly="FredCK.FCKeditorV2" Namespace="FredCK.FCKeditorV2" TagPrefix="FCKeditorV2" %>
<!--Panel danh sách các tham số -->
<style type="text/css">
    .style1
    {
        width: 60%;
    }
    .style2
    {
        color: Blue;
        font-size: 25px;
        margin-left: 50px;
    }
    
    .style3
    {
        color: Red;
        font-weight: bold;
    }
    
    .style4
    {
        color: #FF0000;
    }
    .style5
    {
        width: 47%;
    }
    
    .style6
    {
        width: 201px;
    }
    .style7
    {
        width: auto;
    }
    
    .style8
    {
        color: #FF0000;
        margin-top: 100px;
        margin-left: 100px;
    }
    .style9
    {
        width: 535px;
        text-align: right;
        color: Red;
    }
    
    .tb_left
    {
        width: 15%;
    }
    
    .tb_center
    {
        width: 10%;
    }
    
    .tb_right
    {
        width: 75%;
    }
</style>
<script type="text/javascript" language="javascript">
    function changeCheckState() {
        try {
            var frm = document.forms[0];
            var i = 0;
            for (i = 0; i < frm.length; i++) {
                if (frm.elements[i].id.indexOf('CheckBoxItem') != -1) {
                    if (document.getElementById(frm.elements[i].id) != null) {
                        if (frm.elements[i].checked == false) {
                            frm.elements[i].checked = true;
                        } else {
                            frm.elements[i].checked = false;
                        }
                    }
                }
            }
        } catch (err) { }
    }
</script>
<asp:Panel ID="PanelDanhSachThamSo" runat="server">
    <table style="width: 100%; border: 1px solid #008000;">
        <tr>
            <td class="style1">
                <asp:ImageButton ID="ImageButtonThemMoi" runat="server" ImageUrl="~/Admin/images/add.png"
                    ToolTip="Thêm tham số  mới" OnClick="ImageButtonThemMoi_Click" />
                &nbsp;
                <asp:ImageButton ID="ImageButtonXoa" runat="server" CommandName="Delete" ImageUrl="~/Admin/images/delete.png"
                    ToolTip="Xóa tham số " OnClientClick="return confirm('Bạn có muốn xóa thật không?');"
                    OnClick="ImageButtonXoa_Click" />
                &nbsp; <span class="style2">Danh sách tham số </span>
            </td>
            <td class="style5">
                <span class="style4">Tổng số tham số : </span>&nbsp;
                <asp:Label ID="LabelTongSoThamSo" runat="server" Text="" CssClass="style3">
                </asp:Label>
            </td>
        </tr>
        <tr>
            <td colspan="2">
                <asp:Label ID="LabelThongBao" CssClass="style8" runat="server" Visible="False"></asp:Label>
                <asp:GridView ID="GridViewThamSo" runat="server" AllowPaging="True" AutoGenerateColumns="False"
                    CellPadding="4" ForeColor="#333333" Width="100%" OnRowEditing="GridViewThamSo_RowEditing"
                    OnPageIndexChanging="GridViewThamSo_PageIndexChanging" OnRowDataBound="GridViewThamSo_RowDataBound">
                    <RowStyle BackColor="#EFF3FB" />
                    <Columns>
                        <asp:TemplateField>
                            <HeaderTemplate>
                                <asp:CheckBox ID="CheckBoxAll" runat="server" ToolTip="Check all" onclick="changeCheckState(this);" />
                            </HeaderTemplate>
                            <ItemTemplate>
                                <asp:CheckBox ID="CheckBoxItem" runat="server" ToolTip="Check" OnCheckedChanged="CheckBoxItem_CheckedChanged" />
                            </ItemTemplate>
                            <HeaderStyle Width="20px" />
                        </asp:TemplateField>
                        <asp:TemplateField>
                            <ItemTemplate>
                                <asp:ImageButton ID="ImageButtonSua" runat="server" CommandName="Edit" ImageUrl="~/Admin/images/edit.png"
                                    ToolTip="Sửa thông tin tham số  này" />
                            </ItemTemplate>
                            <HeaderStyle Width="20px" />
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="ID">
                            <ItemTemplate>
                                <asp:Label ID="LabelMaThamSo" runat="server" Text='<%# Eval("MaThamSo") %>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle Width="50px" />
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Tên tham số">
                            <ItemTemplate>
                                <asp:Label ID="LabelTenThamSo" runat="server" Text='<%# Eval("TenThamSo") %>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle Width="350px" />
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Giá trị">
                            <ItemTemplate>
                                <asp:Label ID="LabelGiaTri" runat="server" Text='<%# Eval("GiaTri") %>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle Width="100px" />
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Mô tả">
                            <ItemTemplate>
                                <asp:Label ID="LabelMoTa" runat="server" Text='<%# Eval("MoTa") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                    <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                    <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                    <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                    <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                    <EditRowStyle BackColor="#2461BF" />
                    <AlternatingRowStyle BackColor="White" />
                </asp:GridView>
            </td>
        </tr>
    </table>
</asp:Panel>
<!--Panel thêm mới, sửa thông tin tham số -->
<asp:Panel ID="PanelThemSuaThamSo" runat="server">
    <table style="width: 100%; border: 1px solid #008000;">
        <tr>
            <td class="style1" colspan="2">
                <asp:ImageButton ID="ButtonTroLai" runat="server" ImageUrl="~/Admin/images/back_f2.png"
                    OnClick="ButtonTroLai_Click" ToolTip="Trở lại" />&nbsp;
                <asp:Label ID="LabelTitle" runat="server" CssClass="style2" Text="Thêm mới tham số "></asp:Label>
            </td>
            <td>
                &nbsp;
            </td>
        </tr>
        <tr>
            <td class="style6">
                &nbsp;
            </td>
            <td class="style6">
                <asp:Label ID="LabelMaThamSo" Visible="false" runat="server" Text="Label"></asp:Label>
            </td>
        </tr>
        <tr>
            <td class="tb_left">
                Tên tham số :
            </td>
            <td class="tb_center">
                <asp:TextBox ID="TextBoxTenThamSo" runat="server" ToolTip="Nhập tên tham số" Width="250px">
                </asp:TextBox>
            </td>
            <td class="tb_right">
                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="(*) Vui lòng nhập tên tham số"
                    ControlToValidate="TextBoxTenThamSo" Display="Dynamic" ForeColor="Red" SetFocusOnError="True"
                    ValidationGroup="Nhap"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td class="tb_left">
                Giá trị :
            </td>
            <td class="tb_center">
                <asp:TextBox ID="TextBoxGiaTri" runat="server" ToolTip="Nhập giá trị cho tham số"
                    Width="250px">
                </asp:TextBox>
            </td>
            <td class="tb_right">
                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="TextBoxGiaTri"
                    Display="Dynamic" ErrorMessage="(*) Vui lòng nhập giá trị cho tham số" ForeColor="Red"
                    SetFocusOnError="True" ValidationGroup="Nhap"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td class="tb_left">
                Mô tả tham số:
            </td>
            <td class="tb_center">
                <asp:TextBox ID="TextBoxMoTa" runat="server" Width="245px" ToolTip="Nhập mô tả tham số"
                    Height="83px" TextMode="MultiLine"></asp:TextBox>
            </td>
            <td class="tb_right">
                <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="TextBoxMoTa"
                    Display="Dynamic" ErrorMessage="(*) Vui lòng nhập mô tả cho tham số" ForeColor="Red"
                    SetFocusOnError="True" ValidationGroup="Nhap"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td class="style6">
                &nbsp;
            </td>
            <td class="style9">
                &nbsp;
            </td>
            <td style="text-align: left" class="style7">
                &nbsp;
            </td>
        </tr>
        <tr>
            <td class="style6">
                &nbsp;
            </td>
            <td style="text-align: left" class="style14">
                <asp:Button ID="ButtonLuu" runat="server" OnClick="btnLuu_Click" Text="Lưu" ValidationGroup="Nhap"
                    Width="80px" ToolTip="Lưu lại" CommandName="ThemMoi" />
                &nbsp;
                <asp:Button ID="ButtonNhapLai" runat="server" OnClick="btnNhaplai_Click" Text="Nhập lại"
                    Width="80px" ToolTip="Nhập lại" />
            </td>
            <td style="text-align: left" class="style6">
                &nbsp;
            </td>
        </tr>
    </table>
</asp:Panel>
